package com.jawmask.android.stuartproair.constants;

import android.content.Context;
import android.content.Intent;

import com.jawmask.android.stuartproair.ui.WebBrowserActivity;

public final class UIUtils {

	private static UIUtils uiUtils;

	private UIUtils() {

	}

	public static UIUtils getInstance() {
		if (uiUtils == null)
			uiUtils = new UIUtils();
		return uiUtils;
	}

	public void launchWebBrowserScreen(final Context context, final String urltoLoad, final String title) {
		Intent intent = new Intent(context, WebBrowserActivity.class);
		intent.putExtra(AppConstants.EXTRA_KEY_NAME_URL_TO_LOAD, urltoLoad);
		intent.putExtra(AppConstants.EXTRA_KEY_NAME_BROWSER_TITLE_NAME, title);
		context.startActivity(intent);
	}

	public void launchEmailClient(final Context context, final String toEmail, final String emailSubject, final String emailbody,
			final String emailClientTitle) {
		Intent emailIntent = new Intent(Intent.ACTION_SEND);
		emailIntent.setType("plain/text");
		emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { toEmail });
		emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, emailSubject);
		emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailbody);
		context.startActivity(Intent.createChooser(emailIntent, emailClientTitle));
	}
}
